import {
  ORDER,
  HANDLE_ORDER,
  ORDERSCOUNT,
  REFUND_ORDER,
  CREATE_LOGISTICS,
} from './api';
import { METHOD, request } from '@/utils/request';

//获取订单列表
export async function getOrderList(params) {
  return request(ORDER, METHOD.GET, params);
}

//获取订单详细信息
export async function orderDetail(params) {
  return request(HANDLE_ORDER, METHOD.DYNAMIC, params);
}

//更新订单状态
export async function updateOrderStatus(params) {
  return request(HANDLE_ORDER, METHOD.PUT, params);
}

//获取成交订单数量
export async function getOrderCount(params) {
  return request(ORDERSCOUNT, METHOD.GET, params);
}

//订单退款
export async function refundOrder(params) {
  return request(REFUND_ORDER, METHOD.POST, params);
}

//创建物流
export async function createLogistics(params) {
  return request(CREATE_LOGISTICS, METHOD.POST, params);
}

export default {
  getOrderList,
  orderDetail,
  updateOrderStatus,
  getOrderCount,
  refundOrder,
  createLogistics,
};
